﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.Entity;
using System.Web;

namespace HdipCricketClub.Models
{
    public class OpponentOtherFixtureDetailRepository
    {
        CricketClubEntities db = new CricketClubEntities();

        public OpponentOtherFixtureDetail GetOpponentOtherFixtureDetail(Fixture fixture)
        {
            OpponentOtherFixtureDetail opponentOtherFixtureDetail = db.OpponentOtherFixtureDetails.Where(oofd => oofd.fixture_id == fixture.fixture_id).Single();

            return opponentOtherFixtureDetail;
        }

        public OpponentOtherFixtureDetail GetOpponentOtherFixtureDetail(int id)
        {
            OpponentOtherFixtureDetail opponentOtherFixtureDetail = db.OpponentOtherFixtureDetails.Where(oofd => oofd.fixture_id == id).Single();

            return opponentOtherFixtureDetail;
        }




        public double GetTotalOpponentExtras(OpponentOtherFixtureDetail opponentOtherFixtureDetail)
        {
            return (double)(opponentOtherFixtureDetail.byes + opponentOtherFixtureDetail.leg_byes + opponentOtherFixtureDetail.wides + opponentOtherFixtureDetail.no_balls);
        }


    }
}